﻿Imports Ultimus.WFServer
Imports beCapitalAdicional
Partial Public Class frmMetodoEstandarPrc
    Inherits System.Web.UI.Page

    Private ruta As String
    Private nombrePaso As String

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Try
            If Not Page.IsPostBack Then
                lblFecha.Text = Date.Now.ToShortDateString


                ' Cargar Variables Ultimus 
                Dim staskid As String = Request.Cookies("TaskId").Value
                Session("TaskId") = staskid
                Dim oTask As New Task
                oTask.InitializeFromTaskId(staskid)
                nombrePaso = oTask.strStepName

                ' Cargar fomrmulario
                Title = nombrePaso
                lblTitulo.Text = nombrePaso

                ConfigurarScripts()
                CargarComponenteProciclico()

            End If
        Catch ex As Exception

        End Try
    End Sub
    Private Sub ConfigurarScripts()
        ruta = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath

        btnComentario.Attributes.Add("onclick", "VerComentario('" + ruta + "');")
        btnTrazabilidad.Attributes.Add("onclick", "VerTrazabilidad('" + ruta + "');")
        imbRetornar.Attributes.Add("onclick", "VerPasoRetroceso('" + ruta + "','" + nombrePaso + "');")
    End Sub
    Private Sub CargarComponenteProciclico()
        'Dim valor As String
        'Dim objMetodoEstandar As New beMetodoEstandar
        'objMetodoEstandar.Fecha = Date.Now.ToShortDateString
        'objMetodoEstandar.EstadoComponenteProciclico = 0
        'objMetodoEstandar.ProvisionProciclica = 0


        'With objMetodoEstandar
        '    lblFecha.Text = .Fecha
        '    lblProvisionesProciclicas.Text = .ProvisionProciclica

        '    For i = 0 To rblEstado.Items.Count
        '        valor = rblEstado.Items(i).Value

        '        If valor = .EstadoComponenteProciclico Then
        '            rblEstado.Items(i).Selected = True
        '        End If
        '    Next
        'End With


    End Sub

    Protected Sub imbEnviar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imbEnviar.Click
        Dim sUser As String = Request.Cookies("UserId").Value
        Dim staskid As String = Request.Cookies("TaskId").Value

        Dim oTask As New Task
        oTask.InitializeFromTaskId(staskid)
        Dim nIncident As Integer = 0
        Dim sError As String = ""
        oTask.Send(Nothing, Nothing, Nothing, nIncident, sError)

        ScriptManager.RegisterStartupScript(Me, Page.GetType, "Aviso", "window.close();", True)
    End Sub

End Class